#include <iostream>
#include <math.h>
using namespace std;
/*int main( )
{
int n;

double pi(0);


for(n=1;1.0/(2*n-1)>1e-8;n++)


	pi=pi+1.0/(2*n-1)*(n%2?1:-1);
	pi=pi*4;

    cout<<"n="<<n<<"pi="<<pi<<endl;
return 0;
} 
int main()
{

int a=1;
int b=2;
int sum =0;
for(a=1;a<=100;a++)
{
	
	sum+=a*b;
    b++;

}
cout<<sum;
return 0;
}

/*int main( )
{
int n=1;
double sum=0;
double pi=0.0;
sum=1.0/(2*n-1);

for(n=1;sum>=1e-8;n++)
{

	pi=pi+sum*(n%2?1:-1);
	pi=pi*4;
}
    cout<<"pi="<<pi<<endl;
return 0;
} */
int main()
{
	int x;
	int y=0;
	cin>>x;
	if(x<1)
	   y=x;
	else if(1<=x&&x<10)
	   y=(2*x*x)-1;
	else if(x>=10)
	   y=3*x*x-11;
	cout<<y<<endl;
	
	return 0;
}

/*int main( ) 

{
    char c;
	int i=65;
	int n=90;
	while(i<=90)
{
	c =i;
	cout<<c;
	i++;
}
	cout<<endl;


    while(n>=65)
{
	char d =n;
	cout<<d;
	n--;
}
}

/*
int main( )
{

    int i=90;
    while(i>=65)
{
	char d =i;
	cout<<d;
	i--;
}
	return 0;
}*/
